import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        // 创建建筑
        Building building1 = new Building("Science Building", "North Campus");
        Building building2 = new Building("Arts Building", "South Campus");

        // 创建学院
        College college = new College();
        college.addBuilding(building1);
        college.addBuilding(building2);

        // 创建课程并关联到建筑
        Course course1 = new Course(building1); // 正常的课程，绑定在Science Building
        Course course2 = new Course(building2); // 正常的课程，绑定在Arts Building
        Course courseWithoutBuilding = new Course(null); // 没有绑定建筑的课程

        // 添加课程到学院
        college.addCourse(course1);
        college.addCourse(course2);
        college.addCourse(courseWithoutBuilding); // 这行代码会触发提示“每个Course必须在某个Building中进行”

        // 输出结果
        System.out.println("学院的建筑物：");
        for (Building building : college.getBuildings()) {
            System.out.println(building.getName() + " 位于 " + building.getLocation());
        }

        System.out.println("\n学院的课程：");
        for (Course course : college.getCourses()) {
            System.out.println("课程在 " + course.getBuilding().getName());
        }
    }
}
